package com.taoban.shopdata.common;

import java.util.ArrayList;
import java.util.List;

import com.yufei.entity.goods.Goods;
import com.yufei.pfw.service.PfwService;
import com.yufei.pfw.service.QueryPaire;
import com.yufei.pfw.service.QueryServiceExcetion;
import com.yufei.utils.SpringUtils;

public class MyOwnIsShouldUpdate implements IsShouldUpdate {
	PfwService pfwService=(PfwService) SpringUtils.getBeanFromBeanContainer(PfwService.class);

	@Override
	public boolean isShouldUpdate(String mallId,String mallItemId) {
		// TODO Auto-generated method stub
		if(mallId==null){
			List<QueryPaire> queryPairs=new ArrayList<>();
			queryPairs.add(new QueryPaire("mallItemId", "is:"+mallItemId+""));
			try {
				long count=pfwService.count(queryPairs, Goods.class);
				if(count>0){
					return true;
				}
			} catch (QueryServiceExcetion e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return false;
	}

}
